function toUpdateAdmin(obj){
    var id=obj.id;
    document.getElementById(id).innerHTML="保存"
    console.log(obj);
    document.getElementById("username"+id).disabled="";
    document.getElementById("password"+id).disabled="";
    document.getElementById("email"+id).disabled="";
    document.getElementById("role"+id).disabled="";
    document.getElementById(obj.id).onclick = function() {
        updateAdmin(id);
    }
}
function updateAdmin(id){
    var form=document.getElementById("form");
    var input1 = document.createElement("input");
    input1.setAttribute("type", 'hidden');
    input1.setAttribute("name", 'adminId');
    input1.setAttribute("value", id);
    if (id==='1'){
        var input2 = document.createElement("input");
        input2.setAttribute("type", 'hidden');
        input2.setAttribute("name", 'role');
        input2.setAttribute("value", "ROLE_ADMIN");
        form.appendChild(input2);
    }
    console.log(input1);
    form.appendChild(input1);
    form.action="/adminManger/updateAdmin";
    form.submit();
}
function deleteAdmin(obj){
    var id=obj.id.replace('delete','');
    var form=document.getElementById("form");
    var input1 = document.createElement("input");
    input1.setAttribute("type", 'hidden');
    input1.setAttribute("name", 'adminId');
    input1.setAttribute("value", id);
    form.appendChild(input1);
    form.action="/adminManger/deleteAdmin";
    form.submit();
}
function insertAdmin(){
    var form=document.getElementById("form");
    form.action="/adminManger/insertAdmin";
    form.submit();
}